package command.tv;

/**
 * 接收者（Receiver）:
 * 知道如何执行与请求相关的操作，实际执行命令的对象。
 */
public class Television {

    private boolean isOn;
    private int volume;

    public Television() {
        this.isOn = false;
        this.volume = 50;
    }

    public void turnOn() {
        this.isOn = true;
    }

    public void turnOff() {
        this.isOn = false;
    }

    public void volumeUp() {
        this.volume++;
    }

    public void volumeDown() {
        this.volume--;
    }

    public boolean isOn() {
        return isOn;
    }

    public void printStatus() {
        System.out.println("TV is " + (this.isOn ? "on" : "off") + " and volume is " + this.volume);
    }


}